home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / AEWIN100.ARJ / INITSCR.CC < prev    next >
C/C++ Source or Header  |  1991-10-27  |  2KB  |  76 lines

  1. /**********************************************************************
  2.  *  
  3.  *  NAME:           initscr.cpp
  4.  *  
  5.  *  DESCRIPTION:    initialize window library
  6.  *
  7.  *                  also, miscellaneous functions that
  8.  *                  don't seem to fit anywhere else
  9.  *  
  10.  *  copyright (c) 1990 J. Alan Eldridge
  11.  * 
  12.  *  M O D I F I C A T I O N   H I S T O R Y
  13.  *
  14.  *  when        who                 what
  15.  *  -------------------------------------------------------------------
  16.  *  11/??/90    J. Alan Eldridge    created
  17.  *  
  18.  *********************************************************************/
  19.  
  20. #include    "w.h"
  21.  
  22. //  current image of display screen
  23.  
  24. vidbuf  Screen;
  25.  
  26. //  initialize the window library: MUST CALL THIS OR ELSE!
  27. //  (the constructor for class vidbuf calls it just to be sure)
  28. //  if it doesn't return OK, something is seriously wrong!
  29.  
  30. static int  initscrCalled = FALSE;
  31. static int  initscrResult;
  32.  
  33. int
  34. initscr(
  35.     int     vidmode,
  36.     char    *vidvar)
  37. {
  38.     if (initscrCalled)
  39.         return initscrResult;
  40.  
  41.     initscrCalled = TRUE;
  42.  
  43.     //  application can override this call by calling vid_open()
  44.     //  before calling initscr(). this works because the video interface
  45.     //  will only initialize itself once.
  46.     
  47.     vid_open(vidmode, vidvar);
  48.     
  49.     //  set up current screen image buffer
  50.     
  51.     Screen.open(0, 0, vid_rows()-1, vid_cols()-1);
  52.     Screen.clear();
  53.     Screen.setpos(0, 0);
  54.     Screen.refresh();
  55.     return initscrResult = Screen.status();
  56. }        
  57.  
  58. //  annoy the user
  59.  
  60. void
  61. beep(
  62.     int     nTimes,
  63.     uint    howLong,
  64.     uint    Hz)
  65. {
  66.     while (nTimes-- > 0) {
  67.         sound(Hz);
  68.         delay(howLong);
  69.         nosound();
  70.         if (nTimes > 0)
  71.             delay(333);
  72.     }
  73. }
  74.  
  75.  
  76.